package wangjg.mda.lang;

import java.util.List;

public class MyClass extends MyElement {
	private List<String> imports;
	private MyPackage _package;
	private String superClass;
	private String name;
	private int namePos;
	private List<MyField> fields;
	private List<MyMethod> methods;
	private List<MyAnnotation> annos;
	private MyComment comment;
	private List<String> implts;
	
	public String getFullname(){
		if(_package==null||_package.getName()==null||_package.getName().isEmpty()){
			return name;
		}else{
			return _package.getName()+'.'+name;
		}
	}
	
	public MyAnnotation getAnnotation(String annoName){
		if(annos==null){
			return null;
		}
		for(MyAnnotation anno:annos){
			if(annoName!=null&&annoName.equals(anno.getName())){
				return anno;
			}
		}
		return null;
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getNamePos() {
		return namePos;
	}
	public void setNamePos(int namePos) {
		this.namePos = namePos;
	}
	public List<MyField> getFields() {
		return fields;
	}
	public void setFields(List<MyField> fields) {
		this.fields = fields;
	}
	public List<MyMethod> getMethods() {
		return methods;
	}
	public void setMethods(List<MyMethod> methods) {
		this.methods = methods;
	}
	public List<MyAnnotation> getAnnos() {
		return annos;
	}
	public void setAnnos(List<MyAnnotation> annos) {
		this.annos = annos;
	}
	public MyPackage getPackage() {
		return _package;
	}
	public void setPackage(MyPackage _package) {
		this._package = _package;
	}
	public String getSuperClass() {
		return superClass;
	}
	public void setSuperClass(String superClass) {
		this.superClass = superClass;
	}

	public MyComment getComment() {
		return comment;
	}

	public void setComment(MyComment comment) {
		this.comment = comment;
	}

	public List<String> getImplts() {
		return implts;
	}

	public void setImplts(List<String> implts) {
		this.implts = implts;
	}

	public List<String> getImports() {
		return imports;
	}

	public void setImports(List<String> imports) {
		this.imports = imports;
	}

	@Override
	public String toString() {
		return "\n\tMyClass [\nimports=" + imports + ", \npackage=" + _package
				+ ", \nsuperClass=" + superClass + ", \nname=" + name
				+ ", namePos=" + namePos + ", \nfields=" + fields + ", \nmethods="
				+ methods + ", \nannos=" + annos + ", \ncomment=" + comment
				+ ", \nimplts=" + implts + "]\n";
	}
	
}
